home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 4685 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.0 KB

  1. Path: news1.h1.usa.pipeline.com!usenet
  2. From: grantp@usa.pipeline.com(Pete)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Beginner: How to #include
  5. Date: 31 Jan 1996 17:35:40 GMT
  6. Organization: Kalevi, Inc.
  7. Message-ID: <4eo99c$lnc@news1.usa.pipeline.com>
  8. NNTP-Posting-Host: pipe4.h1.usa.pipeline.com
  9. X-PipeUser: grantp
  10. X-PipeHub: usa.pipeline.com
  11. X-PipeGCOS: (Pete)
  12. X-Newsreader: Pipeline USA v3.3.0
  13.  
  14. On Jan 30, 1996 18:32:06 in article <Beginner: How to #include>,
  15. 'west@emt.e-technik.tu-muenchen.de (Robert Westendorp)' wrote: 
  16.  
  17. The "standard" way to suppress multiple definitions/declarations 
  18. in a header file that may be included more than once is to wrap 
  19. all the code therein inside a #ifdef - #endif block 
  20.  
  21. >Hi there,  
  22. >following problem with hierarchical including: 
  23. >my_data.h: 
  24. #if !defined(_MY_DATA_H_) 
  25. #define _MY_DATA_H 
  26.  
  27. >#include "picture.h" 
  28. >class A  
  29. >{ 
  30. >... 
  31. >CPicture m_picture; 
  32. >... 
  33. >} 
  34.  
  35. #endif  // last line in your .h file to match the first #if !defined 
  36.  
  37. -- 
  38. Pete Grant 
  39. Kalevi, Inc. 
  40. Object Oriented Software Development
  41.